package com.huawei.hms.support.api.sns.json;

import android.content.Intent;
import android.os.Parcelable;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.RemoteBuoyAction;
import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.internal.ResponseErrorCode;
import com.huawei.hms.common.internal.TaskApiCall;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.sns.json.SnsOutIntent;
import com.huawei.hms.support.api.sns.json.SnsClient.Callback;
import com.huawei.hms.support.log.HMSLog;
import o.fjx;

public class SnsTaskApiCall extends TaskApiCall<SnsHmsClient, SnsOutIntent> {
    Callback a;
    private SnsClientImpl b;
    private String c;

    public SnsTaskApiCall(String str, String str2) {
        super(str, str2);
    }

    public SnsTaskApiCall(String str, String str2, Callback callback, SnsClientImpl snsClientImpl) {
        super(str, str2);
        this.a = callback;
        this.b = snsClientImpl;
        this.c = str;
    }

    protected void doExecute(SnsHmsClient snsHmsClient, ResponseErrorCode responseErrorCode, String str, fjx<SnsOutIntent> o_fjx_com_huawei_hms_support_api_entity_sns_json_SnsOutIntent) {
        HMSLog.i("SnsTaskApiCall", "onResult " + str);
        SnsOutIntent snsOutIntent = new SnsOutIntent(str);
        this.b.biReportExit(this.c, getTransactionId(), responseErrorCode.getStatusCode(), responseErrorCode.getErrorCode());
        if (responseErrorCode.getErrorCode() == 0) {
            Parcelable parcelable = responseErrorCode.getParcelable();
            if (parcelable instanceof Intent) {
                Intent intent = (Intent) parcelable;
                str = str + RemoteBuoyAction.REMOTE_BUOY_URI + intent.toUri(0);
                HMSLog.i("SnsTaskApiCall", "onResult " + str);
                snsOutIntent.setIntent(intent);
            }
            o_fjx_com_huawei_hms_support_api_entity_sns_json_SnsOutIntent.ॱ(snsOutIntent);
            if (this.a != null) {
                this.a.notify(str);
                return;
            }
            return;
        }
        o_fjx_com_huawei_hms_support_api_entity_sns_json_SnsOutIntent.ॱ(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason())));
        if (this.a != null) {
            this.a.notify("error " + responseErrorCode.getErrorReason());
        }
    }
}
